package com.example.消息可靠性.发送方保证.事务方式;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class MessageService {

    @Autowired
    RabbitTemplate rabbitTemplate;


    @Transactional
    public void send(){
        rabbitTemplate.convertAndSend(TranConfig.TRAN_EXCHANGE,TranConfig.TRAN_QUEUE,"hello");
        int i=1/0;
    }
}
